package day03;
import java.util.Scanner;
public class Task03 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        //1. 接收用户输入的一个整数num，判断它的正负零值，正数则输出"+"，负数则输出"-"，0则输出"0"

        System.out.println("请输入一个整数");
        int num = scan.nextInt();
        if (num>0) {
            System.out.println("+");
        } else if (num<0) {
            System.out.println("-");
        }else{
            System.out.println(0);
        }

        //2.接收用户输入的年份year和月份month，计算该年该月的天数，并输出
        System.out.println("请输入年份");
        int year = scan.nextInt();
        System.out.println("请输入月份");
        int month = scan.nextInt();
        switch (month){
            case 1:
                System.out.println(31);
                break;
            case 2:
                if ((year%4==0 && year%100!=0) || year%400==0){
                    System.out.println(29);
                }else {
                    System.out.println(28);
                }
                break;
            case 3:
                System.out.println(31);
                break;
            case 4:
                System.out.println(30);
                break;
            case 5:
                System.out.println(31);
                break;
            case 6:
                System.out.println(30);
            case 7:
                System.out.println(31);
                break;
            case 8:
                System.out.println(31);
                break;
            case 9:
                System.out.println(30);
                break;
            case 10:
                System.out.println(31);
                break;
            case 11:
                System.out.println(30);
                break;
            case 12:
                System.out.println(31);
                break;
            default:
                System.out.println("请输入正确的时间");
        }

        //3.利用循环语句while计算数字1到100的和，并输出
        int a = 1;
        int sum = 0;
        while (a<=100){
            sum+=a;
            a++;
        }
        System.out.println(sum);

        //4.输出1900到2023年之间所有的闰年(每够10个年份，换一行)
        int count=0;
        for(int years=1900;years<=2023;years++){
            if((years%4==0 && years%400!=0) || years%400==0){
                System.out.print(years+" ");
                count++;
                if(count%10==0){
                    System.out.println();
                }
            }
        }
    }
}
